package br.com.sgmf.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import br.com.sgmf.dao.SetorDAO;
import br.com.sgmf.model.Setor;

@Service
public class SetorService {

	@Autowired
	private SetorDAO setorDAO;

	public void saveOrUpdate(Setor setor) {
		if (setor.getId() == null) {
			setorDAO.save(setor);
		} else {
			setorDAO.update(setor);
		}
	}

	public void delete(Setor setor) {
		setorDAO.delete(setor);
	}

	public Setor findById(Integer id) {
		return setorDAO.findById(id);
	}

	public List<Setor> findAll() {
		return setorDAO.findAll();
	}
}
